Namespace ShapeLibrary
    <Designer(GetType(ShapeLibrary.Design.LineDesigner))> _
    Friend Class Line
        Inherits Shape
        Private m_color As Color = SystemColors.WindowText
        Private m_startPoint As PointF
        Private m_endPoint As PointF
        Private m_width As Single

        '''
        ''' The color that will be used to draw the line.
        '''
        <Description("The color of the line.")> _
        Public Property Color() As Color
            Get
                Return m_color
            End Get

            Set(ByVal Value As Color)
                m_color = Value
            End Set
        End Property
        '''
        ''' The Width of the line that will be drawn.
        '''
        <Description("The color of the line.")> _
        Public Property Width() As Single
            Get
                Return m_width
            End Get

            Set(ByVal Value As Single)
                m_width = Value
            End Set
        End Property
        '''
        ''' The end point, in pixels, of the line.
        '''
        <Description("The ending point of the line.")> _
         Public Property EndPoint() As PointF
            Get
                Return m_endPoint
            End Get

            Set(ByVal Value As PointF)
                m_endPoint = Value
            End Set
        End Property

        '''
        ''' The start point, in pixels, of the line.
        '''
        <Description("The starting point of the line.")> _
        Public Property StartPoint() As PointF
            Get
                Return m_startPoint
            End Get

            Set(ByVal Value As PointF)
                m_startPoint = Value
            End Set
        End Property

        '''
        ''' Overrides Shape.Draw to draw our line.
        '''
        Friend Overrides Sub Draw(ByVal g As Graphics)
            Dim p As Pen = New Pen(Color)
            Try
                g.SmoothingMode = SmoothingMode.AntiAlias
                p.Width = m_width
                g.DrawLine(p, StartPoint, EndPoint)
            Finally
                p.Dispose()
            End Try
        End Sub
    End Class
End Namespace